home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / bin / sos-boot < prev    next >
Text File  |  1992-02-13  |  3KB  |  106 lines

  1. #!/bin/sh
  2. # --------------------------------------------------------------------------
  3. # Copyright 1992 by Forschungszentrum Informatik (FZI)
  4. #
  5. # You can use and distribute this software under the terms of the licence
  6. # you should have received along with this program.
  7. # If not or if you want additional information, write to
  8. # Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  9. # D-7500 Karlsruhe 1, Germany.
  10. # --------------------------------------------------------------------------
  11. # 'sos-boot - 05:06:91 - Dietmar Theobald'
  12. #
  13. # sos-boot
  14. #
  15. # The SOS version is booted, i.e. its compiler is bootstrapped and the version
  16. # is (re-)generated using this compiler.
  17. #
  18. # The compiler bootstrap is done in several phases, each phase consists of
  19. # three steps:
  20. #  - initializing the container directory,
  21. #  - compiling all SOS schemas which are classified as boot schemas,
  22. #  - generating a boot version of the version's compiler using the previously
  23. #    generated schema files.
  24. # The last step is not performed if the generated schema files did not change
  25. # with respect to the previous phase. This signals also that the bootstrap of
  26. # a boot compiler is completed.
  27. #
  28. # The final phase consists of the complete generation of the version using the
  29. # previously generated boot compiler.
  30. #
  31. set -e
  32.  
  33.       phase='0'
  34.     version="${SOSPATH-__SOS_INSTALLED_PATH__}"
  35. bootschemas="knl agg dir mta cci"
  36.  
  37. SOSCONTAINER=$version/cnt ; export SOSCONTAINER
  38. SOSC_BOOTING='+'      ; export SOSC_BOOTING
  39.  
  40. cd $SOSCONTAINER
  41. rm -f *.sos
  42. for s in $bootschemas
  43. do
  44.    ln -s $version/src/$s/${s}.sos
  45. done
  46.  
  47. cd $version
  48. rm -f lib/*.o
  49. echo "--- PHASE $phase: make boot_compiler"
  50.    make -r boot_compiler CPP_BOOT=-DBOOT
  51.  
  52. while true
  53. do
  54.    phase=`expr $phase + 1`
  55.    cd $SOSCONTAINER
  56.  
  57.    echo "--- PHASE $phase: initialize" ; sos-init
  58.  
  59.    for s in $bootschemas
  60.    do
  61.       echo "--- PHASE $phase: compile $s" ; sos-cmp $s
  62.    done
  63.  
  64.    differs=''
  65.    for s in $bootschemas
  66.    do
  67.       s_differs=''
  68.       for f in ${s}*.[ch]
  69.       do
  70.         /bin/cmp -s $f $version/src/$s/$f || { s_differs='+'
  71.                                mv -f $f $version/src/$s/$f
  72.                              }
  73.       done
  74.       [ "$s_differs" ] && { echo "--- PHASE $phase: schema $s differs"
  75.                             differs="$differs $s"
  76.                           }
  77.   done
  78.       
  79.   cd $version/src
  80.   for s in $differs
  81.   do
  82.      for f in $s/*.c
  83.      do
  84.     case "$f" in
  85.        *_sos.c | *_scp.c) continue;;
  86.     esac
  87.  
  88.     echo "--- PHASE $phase: sos-scp $f"
  89.     sos-scp $s $version/src/$f
  90.      done
  91.   done
  92.   [ "$differs" ] || break
  93.    
  94.   echo "--- PHASE $phase: make boot_compiler"
  95.      cd $version
  96.      make -r boot_compiler CPP_BOOT=-DBOOT
  97. done
  98.  
  99. cd $SOSCONTAINER; rm -f *.sos *.[ch] *.out
  100.  
  101. echo "--- PHASE 999: make all"
  102.    cd $version
  103.    rm -f `egrep -l BOOT src/*/*.c | sed -e 's|src/[^/]*/\([^ ]*\.\)c|lib/\1o|`
  104.    make -r all
  105.    rm -f bin/init
  106.